package downloader;

import org.jsoup.Jsoup;
import java.io.IOException;
import java.util.Properties;

public class JsoupDownloader implements Downloader{
    public JsoupDownloader(){
        System.out.println("使用Jsoup库下载网页内容");
    }

    @Override
    public String downloader(Properties properties) {
        String html = null;
        // 使用Jsoup库下载网页内容
        try {
            html = Jsoup.connect(properties.getProperty("url")).get().html();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        // 返回下载的网页内容
        return html;
    }
}
